package com.knowif.backend.controller;

import com.alibaba.fastjson.JSONObject;
import com.knowif.backend.service.InterviewExperienceService;
import com.knowif.backend.service.SchoolService;
import com.knowif.pojo.InterviewExperience;
import com.knowif.pojo.School;
import com.knowif.pojo.SchoolExample;
import com.knowif.search.SearchCondition;
import com.knowif.system.model.RestBean;
import com.knowif.util.ExampleUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.List;

/**
 * @author ：Xh
 * @date ：Created in 2019/6/10 0010 20:50
 */
@RestController
@RequestMapping("/wechat")
public class InterviewExperienceController {

    @Autowired
    private InterviewExperienceService interviewExperienceService;

    @PostMapping("/interview/save")
    @Transactional
    public RestBean<?> save(@RequestBody InterviewExperience interviewExperience){
        interviewExperience.setCreateTime(new Date());
        interviewExperienceService.saveInterviewExperience(interviewExperience);
        return RestBean.build(RestBean.success_code);
    }

    @GetMapping("/interview/detail")
    public RestBean<?> interviewDetail(@RequestParam("userId") int userId,@RequestParam("interviewId") int interviewId){
        return interviewExperienceService.detail(interviewId, userId);
    }

}
